﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Reflection;
using System.Configuration;
using System.Security.Cryptography;

namespace DusonFramework.Core.Security
{
    public static class CryptoFactory
    {
        public static ICryptographyProvider SymmetricCreate(SymmetricType symmetricType)
        {
            ISymmetricAlgorithmCreate creator = null;
            switch (symmetricType)
            {
                case SymmetricType.DES:
                    creator = new DESCreator();
                    break;

                case SymmetricType.RC2:
                    creator = new RC2Creator();
                    break;
            }

            return creator.Create();
        }

        public static ICryptographyProvider HashCreate(HashAlgorithmType hashType)
        {
            IHashAlgorithmCreate creator = null;
            switch (hashType)
            {
                case HashAlgorithmType.HashMD5:
                    creator = new MD5Creator();
                    break;

                case HashAlgorithmType.HashSHA1:
                    creator = new SHA1Creator();
                    break;
            }

            return creator.Create();
        }

        public static ICryptographyProvider NonCrptoCreate()
        {
            return new NonCryptoProvider();
        }
    }
}
